Learn R Programming

R.utils (version 2.0.0)

PERCENT< -PERCENT: Assignment operator for delayed assignments

Description

Assignment operator for delayed assignments such that the expression on the right-hand side (RHS) will not be evaluated until the value of the assigned variable (on left-hand side (LHS)) is evaluated. The RHS expression will be evaluted in a local().

Usage

x %<-% value

Arguments

x
The variable name (possibly quoted).
value
The value to be assigned to x.

Value

  • Returns (invisibly) NULL. Note, contrary to <-(), it is not meaniful to do a %<-% b %<-% c %<-% 6.

See Also

Internally delayedAssign() is used.

Examples

Run this code
message("a %<-% ...")
a %<-% { message("Now assigning 'a'"); 1 }
message("b %<-% a")
b %<-% a
message("c %<-% b")
c %<-% b
message("d %<-% 2*c")
d <- 2*c

Run the code above in your browser using DataLab